package com.yeban.javase.day17.test.test3;

import java.util.concurrent.TimeUnit;

/**
 * @Desc TODO
 * @Author yeban
 * @Date 2025/10/31
 */
public class WithdrawThread implements Runnable{

    private Account account;

    public WithdrawThread(Account account) {
        this.account = account;
    }
    @Override
    public void run() {
        for (int i = 0; i < 5; i++) {
            account.withdraw(2000);
            try {
                TimeUnit.MILLISECONDS.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
